#pragma once
#include <string>
#include <type_traits>
#include <sstream>

template<class T>
struct is_string: public std::is_same<std::string, typename std::remove_cv<T>::type>{};


class format
{
public:
	format() {}
	virtual ~format() {}

	template<class... Args>
	static std::string format_parse(std::string& str, Args ...args)
	{
		return unpack(str,args...);
	}

private:
	template<class Value, class... Args>
	static std::string unpack(std::string& str, Value& v, Args ...args)
	{
		auto first_pos = str.find("%v");

		std::stringstream ss;
		ss << v;

		str.replace(first_pos, 2, ss.str());

		return unpack(str,args...);
	}

	template<class Value>
	static std::string unpack(std::string& str, Value& v)
	{
		auto first_pos = str.find("%v");

		std::stringstream ss;
		ss << v;
	
		str.replace(first_pos, 2, ss.str());

		return str;
	}
};

